%section
  .index-banner.hidden-print.hidden-xs.hidden-sm
    = image_tag ufile_public_src_static('index_banner.png'), width: '100%', alt: '灰名单', title: '灰名单'
    .banner-search
      %form.form-inline.search-form{action:"#{search_credit_record_path}"}
        .form-group
          .input-group
            .input-group-addon
              %span.glyphicon.glyphicon-search{"aria-hidden" => "true"}
            %input.form-control.input-lg{:name => "citizen_id", :placeholder => "请输入您要查询的身份证", :type => "text", :value => "#{params[:citizen_id]}"}
            .input-group-addon.btn.btn-danger.search-btn{style:'color: #fff;background-color: #d9534f;border-color: #d43f3a;'}
              查询
  .hidden-md.hidden-lg
    .banner-search
      %form.form-inline.search-form{action:"#{search_credit_record_path}"}
        .form-group
          .input-group
            .input-group-addon
              %span.glyphicon.glyphicon-search{"aria-hidden" => "true"}
            %input.form-control.input-lg{:name => "citizen_id", :placeholder => "请输入您要查询的身份证", :type => "text", :value => ""}/
            .input-group-addon.btn.btn-danger.search-btn{style:'color: #fff;background-color: #d9534f;border-color: #d43f3a;'} 查询

- if @credit_records.count > 0
  %table.table.table-bordered
    %tr
      %th
        %span 姓名：
        = @credit_records.first.person_reported_against
      %th
        %span 身份证号：
        = @credit_records.first.citizen_id
      %th
        %span 举报次数：
        = @credit_records.count
  %table.table.table-bordered
    -@credit_records.each_with_index do |record, index|
      %tr
        %td= index+1
        %th
          %span 案发时间：
          = record.time_of_incident
        %th
          %span 举报原因：
          = record.reported_reason
        %th
          %span 提供人：
          = record.user.realname_ellipsis
  %div{style:'display:table;margin:0 auto'}
    - if user_signed_in?
      =link_to '再次举报此人', root_path+"?citizen_id=#{params[:citizen_id]}", params: params[:citizen_id], class: 'btn btn-danger btn-lg'
    - else
      =link_to '再次举报此人', new_user_session_path, class: 'btn btn-danger btn-lg'

- else
  .alert.alert-danger
    %span{style:'font-size:24px;'}
      %strong 查询结果 
      灰名单系统没有此人相关信息！

    %a.btn.btn-danger.btn-lg{href:"/?citizen_id=#{params[:citizen_id]}"} 
      举报此人

:javascript
  $('.search-btn').click(function(){
    $(this).parentsUntil('.search-form').parent().submit()
  })
